from django.views import View
from django.http import JsonResponse
# from django.utils.decorators import method_decorator
# from django.views.decorators.csrf import csrf_exempt
#
# data = {"code": "200"}
#
#
# # CBV 取消csrf的限制
# @method_decorator(csrf_exempt, name="dispatch")
# class TestView(View):
#
#     def get(self, request):
#         return JsonResponse(data)
from formula.mixin import AuthFormulaApiViews
from .schema import HomeSchema


class Home(AuthFormulaApiViews):
    schema = HomeSchema

    def get(self, request):
        """
        生成id
        """
        print(request.user.user_code)
        return JsonResponse({"code": "2000"})

    def post(self, request):
        """
        查询数据
        """
        print(request.user.user_code)
        return JsonResponse({"code": "2000"})


class LogsDwViews(AuthFormulaApiViews):

    def get(self, request):

        return JsonResponse({"code": "2000"})
